package com.ruicar.afs.cloud.workflow.gwt.processor;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruicar.afs.cloud.common.core.query.QueryCondition;
import com.ruicar.afs.cloud.common.core.security.vo.UserVo;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.CommonGetRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.GetAssignUserRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.request.UserOnlineRequest;
import com.ruicar.afs.cloud.workflow.api.dto.afsprocess.response.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * The type AfsWorkFLowProcessor
 * <p>Description: </p>
 *
 * @author Fzero
 * @version 1.0
 * @date Created on 2020.07.08 16:11:57
 * @since 1.0
 */
public interface AfsWorkFLowQueryProcessor {

    /**
     * Afs f low keys list
     * 处理器适用范围，此处配置为 在流程映射端配置的 afs-映射key
     *
     * @return the list
     */
    List<String> afsFLowKeys();

    /**
     * Check user online list
     * 检查用户是否在线 紫色节点
     *
     * @param userOnlineRequest user online request
     * @return the list
     */
    List<UserOnlineResponse> checkUserOnline(UserOnlineRequest userOnlineRequest);

    /**
     * Gets assign user *
     * 获取指定处理人，按照角色获取用户
     *
     * @param getAssignUserRequest get assign user request
     * @return the assign user
     */
    GetAssignUserResponse getAssignUser(GetAssignUserRequest getAssignUserRequest);

    /**
     * Query org condition query org condition response
     * 获取人员查询条件
     *
     * @return the query org condition response
     */
    QueryOrgConditionResponse queryOrgCondition(CommonGetRequest commonGetRequest);

    /**
     * Query role query role response
     * 获取角色信息 信审端注意返回 组长 申请人等
     *
     * @return the query role response
     */
    QueryRoleResponse queryRole(CommonGetRequest commonGetRequest);

    /**
     * Query user info page
     * 查询人员
     *
     * @param queryCondition query condition
     * @return the page
     */
    Page<QueryUserResponse> queryUserInfo(QueryCondition<Map<String, Object>> queryCondition);

    /**
     * Gets rtn user info *
     * 获取退回人员信息
     *
     * @param commonGetRequest common get request
     * @return the rtn user info
     */
    UserVo getRtnUserInfo(CommonGetRequest commonGetRequest);

    /**
     * Gets apply user info *
     * 获取经销商 根据 queryRole 返回类型判断，貌似只有信审用到
     *
     * @param commonGetRequest common get request
     * @return the apply user info
     */
    UserVo getApplyUserInfo(CommonGetRequest commonGetRequest);

    /**
     * Gets leader *
     * 获取组长 根据 queryRole 返回类型判断，貌似只有信审用到
     *
     * @param commonGetRequest common get request
     * @return the leader
     */
    UserVo getLeader(CommonGetRequest commonGetRequest);

    /**
     * Gets oper user *
     * 获取指定处理人 根据 queryRole 返回类型判断，貌似只有信审用到
     *
     * @param commonGetRequest common get request
     * @return the oper user
     */
    UserVo getOperUser(CommonGetRequest commonGetRequest);

    /**
     * Common node check user user vo
     * 蓝色节点检测人员信息
     *
     * @param commonGetRequest common get request
     * @return the user vo
     */
   default List<UserVo> commonNodeCheckUser(CommonGetRequest commonGetRequest){
       //全部返回
       List<UserVo> rtnList = new ArrayList<>();
       String[] userNames = commonGetRequest.getBodyData().split(",");
       for (String userName : userNames) {
           UserVo userVo = new UserVo();
           userVo.setUsername(userName);
           rtnList.add(userVo);
       }
       return rtnList;
    }
}
